﻿using System.Windows.Forms;
using CodeToHtml;
using DevelopersToolbox;

namespace CodeTools {
    public partial class CodeToHtmlControl : UserControl, IExecutableTool {
        public CodeToHtmlControl() {
            InitializeComponent();
        }

        public void Execute() {
            string code = _code.Text;

            CSharpToHtmlFormatter formatter = new CSharpToHtmlFormatter();
            string result = formatter.Format(code);
            _resultsSource.Text = result;
            _resultsPreview.DocumentText = result;
        }

        private void _execute_Click(object sender, System.EventArgs e) {
            Execute();
        }
    }
}
